import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Button',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyStatelessWidget(),
    );
  }
}

class MyStatelessWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    //定义文本样式

    return Scaffold(
      appBar: AppBar(
        title: Text("Button"),
        actions: <Widget>[
          IconButton(
            icon: Icon(Icons.shopping_cart),
            tooltip: "Open shopping cart",
            onPressed: (){
              print("Shopping cart opened.");
            },
          )
        ],
      ),
      //装饰容器
      body: DecoratedBox(decoration: BoxDecoration(
          gradient: LinearGradient(colors: [Colors.yellow,Colors.red]) ,//渐变颜色
          borderRadius: BorderRadius.all(Radius.circular(3.0)),
          boxShadow: [
            BoxShadow(
              color: Colors.black,
              offset:Offset(3,3),
              blurRadius: 4.0
            )
          ]
        ),
        child: FlatButton(onPressed: null,child: Text("test button"),),
      )
    );
  }

}
